package com.felight.ems.hr;
import java.util.*;


public class Arrays {

	
	public static void main(String[] args) {
		int[] array={2,8,7,5,0,1,3,4,9,6};
		System.out.println("The elements present in array are");
		for(int i=0;i<array.length;i++){
			System.out.println(array[i]+"\t");
		}
		System.out.println("Enter the number to insert:");
		int num=new Scanner(System.in).nextInt();
		System.out.println("Enter the position to insert:");
		int pos=new Scanner(System.in).nextInt();
		array=insertElement(array,pos,num);
		System.out.println("The elements after insertion:");
		for(int i=0;i<array.length;i++){
			System.out.println(array[i]+"\t");
		}
	}
	
	public static int[] insertElement(int[] array, int pos, int num){
		int[] result = new int[array.length+1];
		for(int i=0;i<pos;i++){
			result[i]=array[i];
		}
		result[pos]=num;
		for(int i=pos+1;i<array.length;i++){
			result[i]=array[i-1];
		}
		return result;
	}

}


